package org.colafries.admin.wrapper;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author colafries
 * @version v1.0
 * @ClassName Response
 * @Description
 * @date Created in 2024/5/27
 **/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
@Data
public class Response<T> implements Serializable {
    public static final String SUCCESS_CODE = "000000";
    public static final String SUCCESS_MESSAGE = "成功";
    public static final String ERROR_CODE = "999999";
    public static final String ERROR_MESSAGE = "失败";

    private String code;
    private String message;
    private T data;

    public Response() {
        this(SUCCESS_CODE, SUCCESS_MESSAGE);
    }

    public Response(String code, String message) {
        this(code, message, (T) null);
    }

    public Response(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


}
